{% load dajaxice_templatetags %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<title>dajaxproject.com - Examples</title>
	<script src="http://www.google.com/jsapi"></script>
    <script>
    
    // Load Prototype
    google.load("prototype", "1.6.0.3");
    //google.load("jquery", "1.3.2");
    //google.load("mootools", "1.2.1");
    //google.load("dojo", "1.3.1");
    
    /**
    Callback test
    **/
    
    function my_callback(data){
        alert(data+' received from server');
    }
    
    </script>

<script src="http://xmlhttprequest.googlecode.com/svn/trunk/source/XMLHttpRequest.js" type="text/javascript" charset="utf-8"></script>
    {% dajaxice_js_import %}

<script type="text/javascript" charset="utf-8">
    var Dajax = Class.create();
	Dajax.prototype = {
    
    initialize:function(){},
    process: function(data)
    {
        data.each(function(elem){
            switch(elem.cmd)
            {
                case 'alert':
                    alert(elem.val)
                break;
        
                case 'data':
                    eval( elem.fun+"(elem.val);" );
                break;
        
                case 'as':
                    $$(elem.id).each(function(e){e[elem.prop] = elem.val;});
                break;
        
                case 'addcc':
                    elem.val.each(function(cssclass){
                        $$(elem.id).each(function(e){ e.addClassName(cssclass);});
                    });
                break;
        
                case 'remcc':
                    elem.val.each(function(cssclass){
                        $$(elem.id).each(function(e){ e.removeClassName(cssclass);});
                    });
                break;
        
                case 'ap':
                    $$(elem.id).each(function(e){ e[elem.prop] += elem.val;});
                break;
        
                case 'pp':
                    $$(elem.id).each(function(e){ e[elem.prop] = elem.val + e[elem.prop];});
                break;
        
                case 'clr':
                    $$(elem.id).each(function(e){e[elem.prop] = "";});
                break;
        
                case 'red':
                    window.setTimeout('window.location="'+elem.url+'";',elem.delay);
                break;
        
                case 'js':
                    eval(elem.val);
                break;
        
                case 'rm':
                    $$(elem.id).each(function(e){e.remove();});
                break;
        
                default:
                    alert('Unknown action!');
            }
        });
    }
};

Dajax = new Dajax();
</script>
	
	{% block extrahead %}{% endblock %}
  </head>
  <body {% block extrabody %}{% endblock %}>

			{% block content %}
			{% endblock %}
  </body>
</html>
